//
//  Keychain.h
//  MailDelivery
//
//  Created by Dante Palacios on 9/24/09.
//  Copyright 2009 Dante Palacios. All rights reserved.
//

/*!
 @header Keychain.h
 @abstract The methods listed here may disappear or change their names without prior notice. For more information, contact palacios.dante\@gmail.com.
 */

#import <Foundation/Foundation.h>
#import <Security/Security.h>


@class KeychainItem;

/*!
 @class Keychain
 @abstract Class to get a save keychain internet items. Can retrive both, MobileMe and regular SMTP accounts but you cannot modify MobileMe items.
 */

@interface Keychain : NSObject {
@private;
    SecKeychainRef _keychain;
}

/*!
 @method sharedKeychain 
 @abstract singleton of the class.
 */

+ (Keychain *)sharedKeychain;

/*!
 @method addKeychainItemForAccount: 
 @abstract try to add a new keyhain item to keychain.
 @discussion If item exists, this method returns the same as in @link keychainItemForAccount: keychainItemForAccount: @/link.
 @param account
 NSDictionary containing hostName, userName, port, and password.
 @result the <tt>KeychainItem</tt> for account.
 */

- (KeychainItem *)addKeychainItemForAccount:(NSDictionary *)account;

/*!
 @method keychainItemForAccount: 
 @abstract returns a keychain item for account (if exists).
 @param account
 NSDictionary containing hostName and userName.
 @result the <tt>KeychainItem</tt> for account.
 */

- (KeychainItem *)keychainItemForAccount:(NSDictionary *)account;

@end